# Makefile for iTextUploader
# Revision: $Id: makefile 108 2009-04-14 20:01:33Z myselftdev $

CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
LD = $(CC)

Options = -arch armv6 \
	-march=armv6 \
	-gdwarf-2 \
	-std=c99 \
	-O3 \
	-mcpu=arm1176jzf-s \
	-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk \
	-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/PrivateFrameworks\
	-bind_at_load \
	-multiply_defined suppress \
	-mthumb

LinkerOptions = -lobjc \
	-lcrypto \
	-lsqlite3 \
	-lz \
	-framework CoreFoundation \
	-framework Foundation \
	-framework CFNetwork \
	-framework AppSupport \
	-framework SystemConfiguration \
	-framework AddressBook

LinkerOptionsService = -lobjc \
	-framework CoreFoundation \
	-framework Foundation

all:	iTextUploader-lite service
	echo "Compiled successfully"

iTextUploader-lite: ASIFormDataRequest.o ITUImport.o SBJSON.o ASIHTTPRequest.o NSData+GzipData.o main.o ASINetworkQueue.o NSHTTPCookieAdditions.o PreferencesData.o AppController.o Reachability.o
	echo "Linking"
	$(LD) $(Options) $(LinkerOptions) -o $@ $^
	echo "Signing binary"
	export CODESIGN_ALLOCATE="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"; ldid -S iTextUploader-lite

service: serviceApp/main.o PreferencesData.o
	echo "Bulding service application"
	$(LD) $(Options) $(LinkerOptionsService) -o $@ $^
	echo "Signing binary"
	export CODESIGN_ALLOCATE="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"; ldid -S service

clean:
	-rm -vf *.o *.gch serviceApp/*.o iTextUploader-lite service

%.o:       %.m
	echo "Generating $@"
	$(CC) -c $(Options) $< -o $@

%.o:       %.c
	echo "Generating $@"
	$(CC) -c $(Options) $< -o $@

%.o:       %.cpp
	echo "Generating $@"
	$(CC) -c $(Options) $< -o $@
